package part15;

import java.util.ArrayList;
import java.util.Random;

/**
 * @author wcj
 * @Date 2021/5/29 17:59
 * @Version 1.0
 */
public class Part1515 {
}

/**
 * 使用泛型可以很轻易的组装比较复杂的模型
 */
class Product {
    private final Integer id;
    private String description;
    private Double price;

    public Product(Integer id, String des, Double price) {
        this.id = id;
        this.description = des;
        this.price = price;
    }

    @Override
    public String toString() {
        return id + ",description:" + description + ",price:" + price;
    }

    private static Generator<Product> generator = new Generator<Product>() {
        private Random random = new Random(47);

        @Override
        public Product next() {
            return new Product(random.nextInt(1000), "test", Math.round(random.nextDouble() * 1000.0) + 0.99);
        }
    };
}
